package cn.community.care.module.system.dal.mysql.materialsinfo;

import cn.community.care.framework.common.pojo.PageResult;
import cn.community.care.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.community.care.framework.mybatis.core.mapper.BaseMapperX;
import cn.community.care.module.system.dal.dataobject.materialsinfo.MaterialsinfoDO;
import org.apache.ibatis.annotations.Mapper;
import cn.community.care.module.system.controller.admin.materialsinfo.vo.*;

/**
 * 物资基本信息 Mapper
 *
 * @author 美妆管理员
 */
@Mapper
public interface MaterialsInfoMapper extends BaseMapperX<MaterialsinfoDO> {

    default PageResult<MaterialsinfoDO> selectPage(MaterialsinfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MaterialsinfoDO>()
                .likeIfPresent(MaterialsinfoDO::getMaterialName, reqVO.getMaterialName())
                .eqIfPresent(MaterialsinfoDO::getMaterialType, reqVO.getMaterialType())
                .eqIfPresent(MaterialsinfoDO::getSpecificationModel, reqVO.getSpecificationModel())
                .eqIfPresent(MaterialsinfoDO::getBrand, reqVO.getBrand())
                .betweenIfPresent(MaterialsinfoDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MaterialsinfoDO::getId));
    }

}